package com.franklin.ideaplugin.maphelper.col.operation.impl.map;

import com.franklin.ideaplugin.maphelper.col.method.IColInsertMethod;
import com.franklin.ideaplugin.maphelper.col.method.IColQueryMethod;
import com.franklin.ideaplugin.maphelper.col.method.impl.ColInsertMethodImpl;
import com.franklin.ideaplugin.maphelper.col.method.impl.DefaultColQueryMethod;
import com.franklin.ideaplugin.maphelper.col.method.impl.PrefixMatchColQueryMethod;

import java.util.Set;

/**
 * fastjson1
 *
 * @author Ye Junhui
 * @since 2024/3/12
 */
public class FastJson1JsonObjectReadWriteOperation extends MapReadWriteOperation {
    @Override
    public String getClassQualifiedName() {
        return "com.alibaba.fastjson.JSONObject";
    }

    @Override
    public Set<IColInsertMethod> getInsertMethods() {
        Set<IColInsertMethod> insertMethods = super.getInsertMethods();
        insertMethods.add(new ColInsertMethodImpl("fluentPut",2,1));
        return insertMethods;
    }

    @Override
    public Set<IColQueryMethod> getQueryMethods() {
        Set<IColQueryMethod> queryMethods = super.getQueryMethods();
        queryMethods.add(new DefaultColQueryMethod("getJSONObject", 1, 0));
        queryMethods.add(new DefaultColQueryMethod("getJSONArray", 1, 0));
        queryMethods.add(new PrefixMatchColQueryMethod("get"));
        return queryMethods;
    }

    @Override
    public Set<IColInsertMethod> getInsertAllMethods() {
        Set<IColInsertMethod> insertAllMethods = super.getInsertAllMethods();
        insertAllMethods.add(new ColInsertMethodImpl("fluentPutAll",1,0));
        return insertAllMethods;
    }
}
